package com.decorator;

/**
 * @author zhupanlin
 * @version 1.0
 * @description: TODO
 * @date 2024/4/15 16:07
 */
public class Decorator extends Drink{
    
    private Drink obj;
    
    public Decorator(Drink obj){
        this.obj = obj;
    }
    
    @Override
    public float cost() {
        // 自己的价格 + 单品咖啡的价格
        return super.getPrice() + obj.getPrice();
    }

    @Override
    public float getPrice() {
        return super.getPrice() + obj.getPrice();
    }

    public String getDes(){
        // obj.getDes() 输出被装饰者的信息
        return super.des + " " + super.getPrice() + "" + obj.getDes();
    }
    
    
}
